<!--
 * @Author: YuHao
 * @Date: 2022-04-14 10:33:15
 * @LastEditTime: 2022-04-14 13:30:04
 * @LastEditors: YuHao
 * @Description: 
 * @FilePath: \vben-admin\src\layouts\default\header\components\FullScreen.vue
 * Copyright (c) 2022 by 弗斯特机电设备有限公司, All Rights Reserved. 
-->
<template>
  <Tooltip :title="getTitle" placement="bottom" :mouseEnterDelay="0.5">
    <span @click="toggle">
      <FullscreenOutlined v-if="!isFullscreen" />
      <FullscreenExitOutlined v-else />
    </span>
  </Tooltip>
</template>
<script lang="ts">
  import { defineComponent, computed, unref } from 'vue';
  import { Tooltip } from 'ant-design-vue';
  import { useFullscreen } from '@vueuse/core';

  import { FullscreenExitOutlined, FullscreenOutlined } from '@ant-design/icons-vue';
  export default defineComponent({
    name: 'FullScreen',
    components: { FullscreenExitOutlined, FullscreenOutlined, Tooltip },

    setup() {
      const { toggle, isFullscreen } = useFullscreen();

      const getTitle = computed(() => {
        return unref(isFullscreen)
          ? '退出全屏'
          : '全屏';
      });

      return {
        getTitle,
        isFullscreen,
        toggle,
      };
    },
  });
</script>
